home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
tppop16.zip
/
TPOP.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-10-05
|
20KB
|
518 lines
TITLE Turbo Pop Version 1.6 beta
SUBTTL Copyright (c)1988 Ross Neilson Wentworth
; This code is Copyright (c)1988 by Ross Neilson Wentworth
; All Rights Reserved
;
; No part of this code may be reproduced, modified, sold, or used
; as an incentive to buy without the expressed written consent of
; the author.
; Routine Quick Reference
;
; EnterPopUp Saves and sets the stack then calls a high-level routine
; InitializePopUp Sets the low-level interrupt vectors
; Installed Sees if the program is already loaded
; new05Int Optional print-screen trap
; new09int Checks for our hotkey combo at each keypress
; new10Int Optional video BIOS trap
; new13int Keeps track of when the disk is busy
; new1Cint Called at each timer tick and checks to see if we
; want to pop up and whether it is safe to do so
; new28int Interrupt routine that is called whenever it is safe
; to interrupt DOS
; new2Fint Intercepts the Multiplex interupt
TRUE equ 1
FALSE equ 0
TRAPINT05 EQU FALSE ; change to TRUE to trap print-screens
TRAPINT10 EQU FALSE ; change to TRUE to trap video BIOS
PUBLIC InitializePopUp,Installed
CSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CSEG
EXTRN callpopup:FAR,ReleaseProgram:FAR
;----------------------------------------------------------------------------
; Miscellaneous data
;----------------------------------------------------------------------------
hotkey LABEL WORD
scancode DB 0 ; scan code of our hotkey
shiftstatus DB 0 ; shift key status (alt,ctrl, etc. )
program_status DB 0 ; true if the program is active
request_flag DB 0 ; true if we want to pop-up
notsafe DB 0 ; non-zero if unsafe to pop up
multiplexID DB 0 ; unique program ID code
stack_pointer DW 0 ; holds our program's stack pointer
stack_segment DW 0 ; holds our program's stack segment
old_pointer DW 0 ; holds the interrupted stack pointer
old_stack DW 0 ; holds the interrupted stack segment
dos_busy_flag DD 0 ; points to DOS's busy flag
; Follows is the interrupt service routine (ISR) installation table.
; Each interrupt will have three entries, the interrupt number, the
; original interrupt vector, and the offset of the ISR. The entire
; table is terminated with a zero byte (this disallows the automatic
; installation of interrupt 00h). There are two ISR's that are optional.
; One traps the print-screen interrupt (05h) and the other traps the video
; BIOS interrupt (10h). By default, these traps are not used. If you wish
; to include them in the interrupt trapping list you must change the EQU's
; above to TRUE. TRAPINT05 is the EQU for trapping the print-screen
; interrupt and TRAPINT10 is the EQU for trapping the video BIOS.
;----------------------------------------------------------------------------
; Interrupt Vector Table
;----------------------------------------------------------------------------
Vectors LABEL BYTE
IF TRAPINT05 ; optional interrupt trap
DB 05h ; print screen vector number
old05int DD ? ; the original print screen interrupt vector
DW offset new05int
ENDIF
DB 09h ; keyboard vector number
old09int DD ? ; the original keyboard interrupt vector
DW offset new09int
IF TRAPINT10 ; optional interrupt trap
DB 10h ; video BIOS vector number
old10int DD ? ; the original video BIOS interrupt vector
DW offset new10int
ENDIF
DB 13h ; disk i/o vector number
old13int DD ? ; the original disk interrupt vector
DW offset new13int
DB 1Ch ; timer vector number
old1Cint DD ? ; the original timer interrupt vector
DW offset new1Cint
DB 28h ; backprocess vector number
old28int DD ? ; the original backprocess interrupt vector
DW offset new28int
DB 2Fh ; multiplex interrupt
old2Fint DD ? ; the original multiplex interrupt vector
DW offset new2Fint
DB 0 ; end of table
;----------------------------------------------------------------------------
; Print-Screen Interrupt Service Routine - 05h
;----------------------------------------------------------------------------
; This is an optional interrupt trap. Change the value of TRAPINT05 to
; TRUE if you want it compiled. This one traps the PRINT SCREEN interrupt
; and prevents popping up in the middle of a screen print.
IF trapInt05
new05int PROC FAR
inc cs:[notsafe] ; increment status flag
pushf
cli
call cs:[old05int] ; chain to original INT 05h handler
pushf ; preserve flags
dec cs:[notsafe] ; decrement status flag
popf ; restore flags
sti ; enable interrupts
ret 2 ; return with flags
new05int ENDP
ENDIF
;----------------------------------------------------------------------------
; Keyboard Interrupt Service Routine - 09h
;----------------------------------------------------------------------------
; Every keystroke is checked through here for our hot_key combination.
; If our's is pressed, a service request flag is set to TRUE. If the
; program is already active we let the keystroke by so that conflicting
; hot-keys will work.
new09int PROC FAR
sti
pushf ; save the flags
push ax ; and a register that gets used
in al,60h ; get the keystroke
cmp al,cs:[scancode] ; is it our key?
jne @F ; no, so jump to original vector
mov ah,2
int 16h ; get the keyboard flags
and al,0Fh ; mask off unused bits
cmp al,cs:[shiftstatus] ; does it match our mask?
jne @F ; no, so jump to original vector
cmp cs:[program_status],FALSE ; are we already active?
jne @F ; yes, so chain to original vector
cmp cs:[request_flag],FALSE ; do we already want serveice?
je L200 ; yes, so chain to original vector
@@:
pop ax ; restore used register
popf ; restore flags
jmp cs:[old09int] ; jump to original vector
L200:
mov cs:[request_flag],TRUE ; say service is desired
cli ; turn off interrupts
mov al,20h ; say interrupt is finished
out 20h,al
in al,61h ; trash the keystroke
mov ah,al
or al,80h
out 61h,al
jmp @F ; jump to nowhere for delay
@@:
mov al,ah
out 61h,al
pop ax ; restore used register
popf ; restore flags
iret ; all done
new09int ENDP
;----------------------------------------------------------------------------
; Video BIOS Interrupt Service Routine - 10h
;----------------------------------------------------------------------------
; This is an optional interrupt trap. Change the value of TRAPINT10 to
; TRUE if you want it compiled. This one traps the video BIOS interrupt
; and prevents popping up in the middle of any screen activity.
IF trapInt10
new